10 REM   LUNAR PERIGEE AND APOGEE
11 INPUT "STARTING JD";J0
12 P0=2415024.89:  M0=27.554551
13 J0=P0+M0*INT((J0-P0)/M0)
14 GOSUB 40    :REM GET CONSTANTS
15 FOR I=1 TO 3: P1=0: P2=0
16 T=(J0-2415020)/36525: T2=T*T
17 M1=R*(296.105+R1*T+0.009192*T2)
18 D=R*(350.737+R2*T-0.001436*T2)
19 M=R*(358.476+R3*T-0.000150*T2)
20 F=R*(11.251+R4*T-0.003211*T2)
21 E=1-0.002495*T-0.00000752*T2
22 FOR J=1 TO 30
23 A(J)=A1(J)*E^C0(J)
24 B(J)=C1(J)*M1+C2(J)*D+C3(J)*M
25 B(J)=B(J)+C4(J)*F
26 P1=P1+A(J)*SIN(B(J))*R(J)
27 P2=P2+A(J)*COS(B(J))*R(J)*R(J)
28 NEXT J
29 J0=J0-(36525/R)*(P1/P2)
30 NEXT I
31 P=950724
32 FOR J=1 TO 30: 
33 P=P+A(J)*COS(B(J))
34 NEXT J
35 K=6378.14/SIN(R*P*0.000001)
36 K=INT(K+0.5): PA$="PERIGEE  "
37 IF P2<0 THEN PA$="APOGEE   "
38 PRINT PA$;K;" KM    JD ";J0
39 J0=J0+13.78: GOTO 15   
40 REM     CONSTANTS
41 DIM A(30),B(30),R(30),A1(30)
42 DIM C0(30),C1(30),C2(30),C3(30)
43 DIM C4(30): R=3.1415926536/180
44 R1=477198.8491: R2=445267.1142
45 R3=35999.0498:  R4=483202.0251
46 FOR J=1 TO 30
47 READ A1(J),C0(J),C1(J)
48 READ C2(J),C3(J),C4(J)
49 R(J)=C1(J)*R1+C2(J)*R2
50 R(J)=R(J)+C3(J)*R3+C4(J)*R4
51 NEXT J
52 RETURN
53 DATA 51818,0,1,0,0,0
54 DATA 9531,0,-1,2,0,0
55 DATA 7843,0,0,2,0,0
56 DATA 2824,0,2,0,0,0
57 DATA 857,0,1,2,0,0
58 DATA 533,1,0,2,-1,0
59 DATA 401,1,-1,2,-1,0
60 DATA 320,1,1,0,-1,0
61 DATA -271,0,0,1,0,0
62 DATA -264,1,1,0,1,0
63 DATA -198,0,-1,0,0,2
64 DATA 173,0,3,0,0,0
65 DATA 167,0,-1,4,0,0
66 DATA -111,1,0,0,1,0
67 DATA 103,0,-2,4,0,0
68 DATA -84,0,2,-2,0,0
69 DATA -83,1,0,2,1,0
70 DATA 79,0,2,2,0,0
71 DATA 72,0,0,4,0,0
72 DATA 64,1,1,2,-1,0
73 DATA -63,1,-1,2,1,0
74 DATA 41,1,0,1,1,0
75 DATA 35,1,2,0,-1,0
76 DATA -33,0,3,-2,0,0
77 DATA -30,0,1,1,0,0
78 DATA -29,0,0,-2,0,2
79 DATA -29,1,2,0,1,0
80 DATA 26,2,0,2,-2,0
81 DATA -23,0,1,-2,0,2
82 DATA 19,1,-1,4,-1,0
83 REM *************************
84 REM  FROM ASTRONOMICAL COM-
85 REM  COMPUTING, SKY & TELE-
86 REM  SCOPE, NOV 87, PAGE 529
87 REM *************************
